freebasicfandomcom-20200214-history
String Functions
String Functions Statements and Procedures that work with strings. Description: These statements and procedures provide many ways to create and manipulate strings and sub-strings. Numbers can be converted to strings and vice-versa. Procedures are also provided to aid in serialization of numeric data, perhaps for persistent storage. Creating Strings String Standard data type: 8 bit character string. STRING (Function) Returns a String of multiple characters. ZString Standard data type: null terminated 8 bit character string. WString Standard data type: wide chfracter string. Returns a WString of multiple characters. Space Returns a String consisting of spaces. WSPACE Returns a WString consisting of spaces. LEN Returns the length of a string in characters. Character Conversion Asc Returns an Integer representation of an character. Chr Returns a string of one or more characters from their ASCII Integer representation. WChr Returns a WString of one or more characters from their Unicode Integer representation. Numeric/Boolean to String Conversions Bin Returns a binary String representation of an integral value. WBin Returns a binary WString representation of an integral value. Hex Returns a hexadecimal String representation of an integral value. WHex Returns a hexadecimal WString representation of an integral value. Oct Returns an octal String representation of an integral value. WOct Returns an octal WString representation of an integral value. Str Returns the String representation of numeric value or boolean. WStr Returns the WString representation of numeric value. Format Returns a formatted String representation of a Double. String to Numeric Conversions Val Returns the Double conversion of a numeric string. ValInt Returns the Integer conversion of a numeric string. LalLng Returns the Long conversion of a numeric string. ValUInt Returns the UInteger conversion of a numeric string. ValULng Returns the ULong conversion of a numeric string. Numeric Serialization Mkd Returns an eight character String representation of a Double. Mki Returns a four character String representation of a Integer. Mkl Returns a four character String representation of a Long. MkLongInt Returns an eight character String representation of a Longint. Mks Returns a four character String representation of a Single. MkShort Returns a two character String representation of a Short. Cvd Returns a Double representation of an eight character String. Cvi Returns an Integer representation of a four character String. Cvl Returns a Long representation of a four character String. CvLongInt Returns a Longint representation of an eight character String. Cvs Returns a Single representation of a four character String. CvShort Returns a Short representation of a two character String. Working with Substrings Left Returns a substring of the leftmost characters in a string. Mid (Function) Returns a substring of a string. Right Returns a substring of the rightmost characters in a string. LCase Returns a copy of a string converted to lowercase alpha characters. UCase Returns a copy of a string converted to uppercase alpha characters.f LTrim Removes surrounding substrings or characters on the left side of a string. RTrim Removes surrounding substrings or characters on the right side of a string. Trim Removes surrounding substrings or characters on the left and right side of a string. InStr Returns the first occurrence of a substring or character within a string. InStrRev Returns the last occurrence of a substring or character within a string. Mid (Statement) Copies a substring to a substring of a string. LSet Left-justifies a string. RSet Right-justifies a string.